package com.home.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class InitIndexServlet extends HttpServlet {


	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setContentType("text/html;charset=GBK");
		Cookie cks[]=request.getCookies();
		boolean loginName =false;
		if(cks!=null&&cks.length>0){
			for(Cookie ck: cks){
				if("loginName".equals(ck.getName())){
					loginName=true;
						break;
				}
			}
			if(loginName){
				response.sendRedirect("/lifemManage/imf.jsp");
			}else{
				response.sendRedirect("/lifemManage/login.jsp");
			}
		}else{
			response.sendRedirect("/lifemManage/login.jsp");
		}
	}


	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		this.doGet(request, response);
	}

}
